<?
    include "../common.php";
    $username = $_POST['username'];
    $sql = "SELECT * FROM users WHERE userName = '{$username}'" ;
    $res = mysqli_query($link,$sql);
    $arr = [] ;
    if( $one = mysqli_fetch_assoc($res) ){
        $arr['status'] = 1 ;
        $arr['info'] = '用户名已存在' ;
    } else {
        $arr['status'] = 2 ;
        $arr['info'] = '可用用户名' ;
    }
    echo json_encode($arr);
?>